package com.hieusua
{
	import com.google.maps.LatLng;
	import com.google.maps.overlays.Marker;
	
	[Bindable]
	public class MarkerWrapper
	{
		public var marker:Marker;
		/* public var lat:Number;
		public var lng:Number; */
		public var latlng:LatLng;
		public var id:String;
		public var visible:Boolean;
		public var optWrapper:MarkerOptionsWrapper;
		// level indicates the importance of the marker, 
		// higher level marker needs higher level delete function to eliminate
		public var level:Number;
		
		public function MarkerWrapper( id:String )
		{
			this.id = id;
			marker = null;
			latlng = new LatLng( 0, 0 );
			visible = false;
			optWrapper = null;
			level = 0; // basic level
		}
		
		public function set lat( value:Number ):void {
			latlng = new LatLng( value, latlng.lng() );
		}
		
		public function set lng( value:Number ):void {
			latlng = new LatLng( latlng.lat(), value );
		}
		
		public function get lat():Number {
			return latlng.lat();
		}
		
		public function get lng():Number {
			return latlng.lng();
		}
		
		public function isBinding( markerOptId:String ):Boolean {
			if ( optWrapper == null ) return false;
			return ( optWrapper.id == markerOptId );
		}

	}
}